#ifndef DEFINE_H__
#define DEFINE_H__

namespace engine
{
	typedef unsigned char               uint8;
	typedef signed char                 int8;
	typedef unsigned short              uint16;
	typedef signed short                int16;
	typedef unsigned int                uint32;
	typedef signed int                  int32;
	typedef signed long long			int64;
	typedef unsigned long long			uint64;

	typedef std::string                 String;
	typedef std::basic_string<wchar_t>  WString;
}

#if defined(_MSC_VER)
	// disable: "<type> needs to have dll-interface to be used by clients'
	// Happens on STL member variables which are not public therefore is ok
#   pragma warning(disable : 4251)
	// disable: "no suitable definition provided for explicit template
	// instantiation request" Occurs in VC7
#   pragma warning(disable : 4661)
	// disable: "non dll-interface class used as base for dll-interface class"
	// Happens when deriving from Singleton because bug in compiler ignores
	// template export
#   pragma warning(disable : 4275)
	/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#   if !defined(_CRT_SECURE_NO_DEPRECATE)
#       define _CRT_SECURE_NO_DEPRECATE
#   endif
	/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#   if !defined(_SCL_SECURE_NO_DEPRECATE)
#       define _SCL_SECURE_NO_DEPRECATE
#   endif
#   if _MSC_VER > 1300
#		define HashMap stdext::hash_map
#   else
#       define HashMap std::hash_map
#	endif
#elif defined(__GNUC__)
#	define HashMap std::hash_map
#   define __GNUC_COMP_VER__ (((__GNUC__)*100) + (__GNUC_MINOR__*10) + __GNUC_PATCHLEVEL__)
#	if __GNUC_COMP_VER__ >= 310
		namespace __gnu_cxx
		{
			template <> struct hash<engine::String>
			{
				size_t operator()(const engine::String &str) const
				{
					register size_t ret = 0;
					for (engine::String::const_iterator it = str.begin(); it != str.end(); ++it)
						ret = 5 * ret + *it;

					return ret;
				}
			};
		}
#	endif
#else
#   pragma error "unknown compiler !"
#endif

/* macro to define a class without copy ctor nor assignment operator     */
#define DECLARE_NO_COPY_CLASS(classname)	\
private:									\
	classname(const classname&);            \
	classname& operator=(const classname&);
/*-----------------------------------------------------------------------*/
#define DECLARE_NO_ASSIGN_CLASS(classname)  \
private:                                    \
	classname& operator=(const classname&);

#define SAFE_DELETE(p)       { if (p) { delete (p);     (p) = NULL; } }
#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p);   (p) = NULL; } }

#endif